<?php


// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();


jimport('joomla.application.component.model');


class ChatterModelChatter extends JModel
{
    private $_lines;

    function getLines()
    {
        if (empty($this->_lines))
        {
			jimport('joomla.filter.output');

			$db = JFactory::getDBO();
            $query = 'SELECT c.*'
				. "\n  FROM #__chatter c"
				. "\n  ORDER BY c.posted DESC"
				;
			$db->setQuery($query, 0, 20);
			$this->_lines = array();
			foreach ($db->loadObjectList() as $line)
			{
				// Prevent XSS attacks.
				JFilterOutput::objectHTMLSafe($line);
				$this->_lines[] = $line;
			}
        }
        return $this->_lines;
    }
}


?>
